//
// Created by cube on 2020/7/31.
//
#include <gtest/gtest.h>

//#include "main_src.h"
#include "CRUDPA/CRUDP.h"


TEST(LL,Client){
    std::cout<<"sss"<<std::endl;
    CRUDPA crudpa(1);
    NetAddress server(INADDR_ANY,9900);
    std::string buf = "hello my is client!";
////    crudpa.bind(NetAddress(INADDR_ANY,9900));
    crudpa.setTimeOut([&](const NetAddress& addr){
        std::cout<<addr.getIp_Char()<<"  "<<addr.getPort()<<std::endl;
    });
    crudpa.setRecv([&](const NetAddress& addr){
        std::cout<<addr.getIp_Char()<<"  "<<addr.getPort()<<"  "<<std::endl;
        crudpa.recv(addr,(int8_t*)buf.data(), 1024);
        std::cout<<buf<<std::endl;
    });
//    crudpa.send(server,(int8_t*)buf.data(),buf.length());
//    crudpa.loop()->exec();
}

int main(int argc, char *argv[])
{
    testing::InitGoogleTest(&argc,argv);
    return RUN_ALL_TESTS();
}
